﻿using System;

namespace Zinnia.Lite.Untilty
{
    /// <summary>
    /// 目录帮助类
    /// </summary>
    public static class DirectoryHelper
    {
        /// <summary>
        /// 获取应用程序根目录
        /// </summary>
        /// <returns></returns>
        public static string GetApplicationRootPath()
        {
            string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
            int binPos = baseDirectory.IndexOf("bin", StringComparison.OrdinalIgnoreCase); //找不到-1
            if (binPos < 0)
                return baseDirectory;
            return baseDirectory.Substring(0, binPos);
        }
    }
}
